<!DOCTYPE html>
<html xmlns:th="www.thymeleaf.org">
<head th:replace="header::head"></head>
<title>找回密码 - 双辞动漫-专注二次元动漫的小站 </title>
<meta name="keywords"
      content="双辞动漫,双辞ACG,弹幕视频,弹幕,字幕,动漫,二次元,ACG,动画,番组,新番,日本动漫,追新番,新番动漫,BGM,治愈动漫,最新动漫,动漫资源,好看的动漫,动漫网"/>
<meta name="description" content="双辞动漫专注于资源收集整理 海量的有效的高质量的动漫，资源下载，最新电影，观看完全免费、高速播放、更新及时在线，我们致力为所有动漫迷们提供最好看的动漫"/>
<script type="text/javascript" src="/template/conch/asset/js/conch.vip.js?v=3.1"></script>
<script type="text/javascript" src="/static/js/home.js"></script>
<script type="text/javascript">
    var maccms = {"path": "", "mid": "6", "url": "www.scdmfun.cn", "wapurl": "www.cdmfun.cn", "mob_status": "0"};
    var conchtpl = {
        "surl": "/search.html",
        "tipt": "网站公告",
        "tipc": "这里是双辞动漫新站<br><span class='hl-text-conch'>注意事项：</span>1.老站新老站账号不通用<br>老站网址：<span class='hl-text-conch'>dm.scdmfun.cn</span><br>2.如果登录后还是提示未登录请稍等一会再刷新即可<br>动漫闲聊群：<span class='hl-text-conch'>542266218</span>",
        "slink": "https://www.scdmfun.cn/",
        "short": "",
        "api": "0",
        "tok": "",
        "term": "long-term",
        "ver": "3.1"
    }
</script>
<body>
<!--海螺影视主题  https://www.360mb.net/23977.html-->
<div th:replace="header::.conch-header"></div>
<div id="conch-content" class="conch-content">
    <div class="conch-ctwrap">
        <div class="container">
            <div class="hl-member">
                <div class="hl-reg-wrap">
                    <form method="post" id="fm" action="">
                        <h2 class="hl-reg-title">邮箱找回密码</h2>
                        <div class="hl-reg-group">
                            <label>账号</label><input type="text" id="user_name" name="user_name" class="hl-reg-control"
                                                    placeholder="请输入您的登录账号" v-model="findpassform.adcount">
                        </div>
                        <div class="hl-reg-group">
                            <label>邮箱</label><input type="text" class="hl-reg-control hl-reg-w2" id="to" name="to"
                                                    placeholder="请输入邮箱" v-model="findpassform.email"><input type="button"
                                                                                                    class="hl-reg-w3 hl-reg-yzm hl-bg-subs"
                                                                                                    id="btn_send_sms" value="获取验证码" @click="getfindpassCode()"/>
                            <div class="divMsg" v-if="errorFlag">邮箱输入错误，请重新输入</div>
                        </div>
                        <div class="hl-reg-group">
                            <label>验证码</label><input type="text" class="hl-reg-control" id="code" name="code"
                                                     placeholder="请输入邮箱验证码" v-model="findpassform.code">
                        </div>
                        <div class="hl-reg-group">
                            <label>新的密码</label><input type="password" id="user_pwd" name="user_pwd"
                                                      class="hl-reg-control" placeholder="请输入您的新密码" v-model="findpassform.password1">
                        </div>
                        <div class="hl-reg-group">
                            <label>确认密码</label><input type="password" id="user_pwd2" name="user_pwd2"
                                                      class="hl-reg-control" placeholder="请输入您的确认密码" v-model="findpassform.password2">
                        </div>
                        <input type="button" id="btn_submit" class="hl-btn-submit hl-bg-conch" value="立即找回" @click="modifypass()">
                    </form>
                    <div class="hl-reg-go hl-text-center clearfix">
                        <a href="/login_admin">登录账号</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!--海螺影视主题  https://www.360mb.net/23977.html-->
<div th:replace="admin::.conch-footer"></div>

<script type="text/javascript">
    new Vue({
        el: '#conch-content',
        data(){
            return {
                findpassform:{
                    adcount: '',
                    email: '',
                    password1: '',
                    password2: '',
                    code: ''
                },
                errorFlag: false   //邮箱格式错误弹出
            }
        },
        methods:{
            findpass(data) {
                return axios({
                    'url': '/admin/findpass_admin',
                    'method': 'put',
                    data
                })
            },
            getfindpassCode(){
                if (this.findpassform.adcount != '') {
                    if (this.findpassform.email == '') {
                        this.errorFlag = true
                    } else {
                        const regex = /^([A-z0-9]{6,18})(\w|\-)+@[A-z0-9]+\.([A-z]{2,3})$/;
                        if (regex.test(this.findpassform.email)) {
                            this.errorFlag = false
                            this.findpass(this.findpassform).then(res => {
                                alert(res.data.msg);
                            })
                        } else {
                            this.errorFlag = true
                        }
                    }
                }else{
                    alert("请输入要找回密码的账号");
                }
            },
            modifypass(){
                if (this.findpassform.adcount != ''){
                    if (this.findpassform.password1 == this.findpassform.password2){
                        this.findpass(this.findpassform).then(res=>{
                            window.location.href="login_admin";
                            alert(res.data.msg)
                        })
                    }else{
                        alert("密码第二次输入错误");
                    }
                }else{
                    alert("请输入要找回密码的账号");
                }
            }
        }

    })
</script>
</body>
</html>